package com.player.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class PlayerDateFormatter {

	private static SimpleDateFormat DATEFORMAT_WITH_TIME = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");

	public static String dateToString(Date date) {
		return DATEFORMAT_WITH_TIME.format(date);
	}

	public static Date stringToDate(String date) {
		try {
			return DATEFORMAT_WITH_TIME.parse(date);
		} catch (ParseException e) {
			throw new IllegalArgumentException("Wrong format of date: " + date);
		}
	}

}
